<template>
  <div class="personnel-container">
    <el-card class="box-card">
      <template #header>
        <div class="card-header">
          <span>人员管理</span>
        </div>
      </template>
      <el-tabs v-model="activeTab" @tab-click="handleTabClick">
        <el-tab-pane label="公司管理" name="company">
          <company-list v-if="activeTab === 'company'" />
        </el-tab-pane>
        <el-tab-pane label="员工管理" name="employee">
          <employee-list v-if="activeTab === 'employee'" />
        </el-tab-pane>
        <el-tab-pane label="访客管理" name="visitor">
          <visitor-list v-if="activeTab === 'visitor'" />
        </el-tab-pane>
      </el-tabs>
    </el-card>
  </div>
</template>

<script>
import { ref } from 'vue'
import CompanyList from './CompanyList.vue'
import EmployeeList from './EmployeeList.vue'
import VisitorList from './VisitorList.vue'

export default {
  name: 'PersonnelManagement',
  components: {
    CompanyList,
    EmployeeList,
    VisitorList
  },
  setup() {
    const activeTab = ref('company')

    const handleTabClick = (tab) => {
      console.log('当前标签页：', tab.props.name)
    }

    return {
      activeTab,
      handleTabClick
    }
  }
}
</script>

<style scoped>
.personnel-container {
  padding: 20px;
}
.box-card {
  width: 100%;
  margin-bottom: 20px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
</style>
